<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:69:"/var/www/html/tp5/public/../application/mobile/view/User/comment.html";i:1529996358;s:57:"/var/www/html/tp5/application/mobile/view/User/index.html";i:1530081068;}*/ ?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="/static/mobile/css/bootstrap/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/mobile/css/login/login.css" />
    <script type="text/javascript" src="/static/mobile/js/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/static/mobile/js/bootstrap/bootstrap.min.js"></script>
</head>
<body>

<div class="">
    <div class="pull-left col-xs-12" style="background-color:#5C5C5C;color:#fff;padding:20px 0px;">
        <div class="col-xs-3 pull-left" style="margin:10px 0px;">
            <div class="img-pos">
                <a href="<?php echo url('mobile/User/index'); ?>">
                    <?php if(!empty($data['face'])): ?>
                    <img src="/uploads/<?php echo $data['face']; ?>" alt="默认头像" width="80">
                    <?php elseif(empty($data['face'])): ?>
                    <img src="/static/mobile/image/face.png" alt="默认头像" width="80">
                    <?php endif; ?>
                </a>
            </div>
        </div>
        <div class="col-xs-9 pull-right">
            <p style="border-bottom: 1px solid #fff;line-height: 50px;font-size: 24px;"><?php echo $data['name']; ?></p>
            <ul class="list-inline col-xs-12">
                <li class="col-xs-6" style="margin-bottom:10px;"><a href="<?php echo url('mobile/User/collect', ['id'=>$data['id']]); ?>" style="color:#fff;">收藏(<span id="fav-num"><?php echo $sc; ?></span>)</a></li>
                <li class="col-xs-6" style="margin-bottom:10px;"><a href="<?php echo url('mobile/User/comment', ['id'=>$data['id']]); ?>" style="color:#fff;">评论(<span id="com-num"><?php echo $pp; ?></span>)</a></li>
                <li class="col-xs-6"><a href="<?php echo url('mobile/User/edit', ['id'=>$data['id']]); ?>" style="color:#fff;">修改资料</a></li>
                <li class="col-xs-6"><a href="<?php echo url('mobile/User/passEd', ['id'=>$data['id']]); ?>" style="color:#fff;">修改密码</a></li>
            </ul>
        </div>
    </div>

<div class="col-xs-12" style="margin-top: 20px;">
    <?php if(empty($result)): ?>
    <center>
        <div class="col-xs-12" style="margin-top: 40px;">
            <a href="<?php echo url('mobile/Index/index'); ?>">还没有评论呦！看小片评论吧</a>
        </div>
    </center>
    <?php elseif(!empty($result)): foreach($result as $v): ?>
    <div class="nav-movie col-xs-12" style="margin-bottom:15px;">
        <a href="<?php echo url('mobile/Index/show', ['id'=>$v['id']]); ?>">
            <img class="pull-left" src="../../../../../uploads/<?php echo $v['cover']; ?>" alt="" width="100">
            <div  class="pull-right  col-xs-8">
                <p class="col-xs-12"><?php echo $v['time']; ?></p>
                <p class="col-xs-12" style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">标题:<?php echo $v['title']; ?></p>
            <p class="col-xs-12" style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">内容:<?php echo $v['comment']; ?></p>
            </div>
        </a>
        <button type="button" class="btn btn-info del-btn" data-id="<?php echo $v['hcid']; ?>" style="margin-left: 35px;">删除评论</button>
    </div>
    <?php endforeach; endif; ?>
</div>

<script>
        $(function(){
        // 触发删除用户
        $('.del-btn').click(function (){
            var ac_id = $(this).attr('data-id');
            if (confirm('你确定要删除吗?!')) {
            var obj = $(this).parent();
            var com = $('#com-num');
            // console.log(obj);
            delAjax(ac_id,obj,com);
        }
        });
        // AJAX删除
        function delAjax(id,obj,com){
            $.ajax({
            type: 'post',
            url: '/mobile/User/delete' ,
            data: {
                id:id
            },
            dataType: 'json',
            success: function (data) {
                    // 将该条目删除掉
                    obj.remove();
                    com.text(com.text()-1);
            },
            error: function () {
                alert('AJAX操作失败');
            }
        });
        }

        })
    </script>

</div>

</body>
</html>
